package sk.klimo.prototyp.client;

import sk.klimo.prototyp.client.event.HasUpdateItemEvents;
import sk.klimo.prototyp.client.event.UpdateItemEvent;
import sk.klimo.prototyp.client.event.UpdateItemEventHandler;

import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;

public class InvoiceForm extends Composite implements HasUpdateItemEvents {

	private TextBox meno;
	private TextBox priezvisko;
	private TextArea adresa;
	private TextBox cislo;
	private TextBox datumVystavenia;
	private TextBox datumSplatnosti;

	public InvoiceForm() {
		Grid grid = new Grid(3, 4);

		meno = new TextBox();
		meno.setMaxLength(25);
		meno.setVisibleLength(25);
		priezvisko = new TextBox();
		priezvisko.setMaxLength(25);
		priezvisko.setVisibleLength(25);
		adresa = new TextArea();
		cislo = new TextBox();
		cislo.setMaxLength(10);
		cislo.setVisibleLength(10);
		datumVystavenia = new TextBox();
		datumVystavenia.setMaxLength(10);
		datumVystavenia.setVisibleLength(10);
		datumSplatnosti = new TextBox();
		datumSplatnosti.setMaxLength(10);
		datumSplatnosti.setVisibleLength(10);
		Label menoLabel = new Label("Meno");
		grid.setWidget(0, 0, menoLabel);
		grid.setWidget(0, 1, meno);

		Label priezviskoLabel = new Label("Priezvisko");
		grid.setWidget(0, 2, priezviskoLabel);
		grid.setWidget(0, 3, priezvisko);

		Label adresaLabel = new Label("Adresa");
		grid.setWidget(1, 0, adresaLabel);
		grid.setWidget(1, 1, adresa);

		Label rcLabel = new Label("Rodne cislo");
		grid.setWidget(1, 2, rcLabel);
		grid.setWidget(1, 3, cislo);

		Label datVyst = new Label("Datum vystavenia");
		grid.setWidget(2, 0, datVyst);
		grid.setWidget(2, 1, datumVystavenia);

		Label datSplat = new Label("Datum splatnosti");
		grid.setWidget(2, 2, datSplat);
		grid.setWidget(2, 3, datumSplatnosti);
		initWidget(grid);
	}

	public TextBox getMeno() {
		return meno;
	}

	public TextBox getPriezvisko() {
		return priezvisko;
	}

	public TextArea getAdresa() {
		return adresa;
	}

	public TextBox getCislo() {
		return cislo;
	}

	public TextBox getDatumVystavenia() {
		return datumVystavenia;
	}

	public TextBox getDatumSplatnosti() {
		return datumSplatnosti;
	}

	public HandlerRegistration addUpdateItemHandler(
			UpdateItemEventHandler handler) {
		return this.addHandler(handler, UpdateItemEvent.TYPE);
	}
}